/*
 * @Author: 飞越疯人院 353362604@qq.com
 * @Date: 2022-09-16 16:23:57
 * @LastEditors: 飞越疯人院 353362604@qq.com
 * @LastEditTime: 2022-10-18 17:31:58
 * @FilePath: \adminstration\src\Common\Modal\TwoModalList\TestType.jsx
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import { API_LIST } from '../../Api/Api'
import { TwoAddBtn, ThrDeleteBtn } from '../options'

export const TestType = async ({ upDataEvent, data, Permission }) => {
    let dataList = {
        type: '摄像头列表',
        hideInSearch: true,
        pageSize: 10,
        params: {},
        classification: 'TableModal',
        get: API_LIST([data.uuid])['getTestTypeCameras'],
        options: [
            Permission.findIndex(v => v.uuid === 'ec59d2ce-afcb-47c4-87d8-dc7c6cfc4a94') !== -1 && (
                <TwoAddBtn
                    upDataEvent={upDataEvent}
                    title="添加摄像头"
                    ThrKey="ThrModal"
                    value="TestType"
                    data={data}
                />
            ),
        ],
        columns: [
            {
                dataIndex: 'uuid',
                title: '编号',
                type: 'hidden',
                hidden: true,
                hideInTable: true,
                hideInSearch: true,
            },
            {
                dataIndex: 'testTypeUuid',
                title: '试验编号',
                type: 'hidden',
                hidden: true,
                hideInTable: true,
                hideInSearch: true,
            },
            {
                dataIndex: 'cameraUuid',
                title: '摄像头编号',
                type: 'hidden',
                hidden: true,
                hideInTable: true,
                hideInSearch: true,
            },
            {
                dataIndex: 'cameraName',
                title: '名称',
                rules: true,
                type: 'input',
            },
            {
                title: '操作',
                valueType: 'systemOperation',
                fixed: 'right',
                width: 220,
                hideInSearch: true,
                hideInAdded: true,
                hideInModify: true,
                render: (_, record) => {
                    return [
                        Permission.findIndex(v => v.uuid === '123c328b-6e8c-4a24-85c8-22687c8573aa') !== -1 && (
                            <ThrDeleteBtn
                                key="delete"
                                record={record.uuid}
                                upDataEvent={upDataEvent}
                                data={{ key: 'delete', url: 'delTestTypeCameras', title: '删除摄像头' }}
                            />
                        ),
                    ]
                },
            },
        ],
    }
    return dataList
}
